package com.system.module.oss.controller;

import com.system.framework.web.domain.Result;
import com.system.module.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@Api(tags = "图片上传接口")
@RestController
@RequestMapping("/common/upload")
public class FileController {

    @Resource
    private FileService fileService;

    @ApiOperation(value = "图片上传")
    @CrossOrigin
    @PostMapping(value = "/file")
    public Result upload(@RequestParam(value = "file") MultipartFile file) {
        return Result.success(fileService.upload(file));
    }
}
